package com.ruowei.modules.foodOrder.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import javax.validation.constraints.*;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 商品sku表
 */
@ApiModel(description = "商品sku表")
@Entity
@Table(name = "merchandise_sku")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class MerchandiseSku implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * sku编码
     */
    @ApiModelProperty(value = "sku编码")
    @Column(name = "sku_code")
    private String skuCode;

    /**
     * 商品编码
     */
    @ApiModelProperty(value = "商品编码")
    @Column(name = "merchandise_code")
    private String merchandiseCode;

    /**
     * 库存
     */
    @ApiModelProperty(value = "库存")
    @Column(name = "stock")
    private Integer stock;

    /**
     * 单价
     */
    @ApiModelProperty(value = "单价")
    @Column(name = "unit_price", precision = 21, scale = 2)
    private BigDecimal unitPrice;

    /**
     * 重量
     */
    @ApiModelProperty(value = "重量")
    @Column(name = "weight")
    private String weight;

    /**
     * 图片
     */
    @Size(max = 2000)
    @ApiModelProperty(value = "图片")
    @Column(name = "photos", length = 2000)
    private String photos;

    /**
     * 包装费
     */
    @ApiModelProperty(value = "包装费")
    @Column(name = "packing_fee")
    private BigDecimal packingFee;

    /**
     * 状态
     */
    @ApiModelProperty(value = "状态")
    @Column(name = "status")
    private Boolean status;

    /**
     * 加入购物车次数
     */
    @ApiModelProperty(value = "加入购物车次数")
    @Column(name = "added_times")
    private Integer addedTimes;

    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getSkuCode() {
        return skuCode;
    }

    public MerchandiseSku skuCode(String skuCode) {
        this.skuCode = skuCode;
        return this;
    }

    public void setSkuCode(String skuCode) {
        this.skuCode = skuCode;
    }

    public String getMerchandiseCode() {
        return merchandiseCode;
    }

    public MerchandiseSku merchandiseCode(String merchandiseCode) {
        this.merchandiseCode = merchandiseCode;
        return this;
    }

    public void setMerchandiseCode(String merchandiseCode) {
        this.merchandiseCode = merchandiseCode;
    }

    public Integer getStock() {
        return stock;
    }

    public MerchandiseSku stock(Integer stock) {
        this.stock = stock;
        return this;
    }

    public void setStock(Integer stock) {
        this.stock = stock;
    }

    public BigDecimal getUnitPrice() {
        return unitPrice;
    }

    public MerchandiseSku unitPrice(BigDecimal unitPrice) {
        this.unitPrice = unitPrice;
        return this;
    }

    public void setUnitPrice(BigDecimal unitPrice) {
        this.unitPrice = unitPrice;
    }

    public String getWeight() {
        return weight;
    }

    public MerchandiseSku weight(String weight) {
        this.weight = weight;
        return this;
    }

    public void setWeight(String weight) {
        this.weight = weight;
    }

    public String getPhotos() {
        return photos;
    }

    public MerchandiseSku photos(String photos) {
        this.photos = photos;
        return this;
    }

    public void setPhotos(String photos) {
        this.photos = photos;
    }

    public BigDecimal getPackingFee() {
        return packingFee;
    }

    public void setPackingFee(BigDecimal packingFee) {
        this.packingFee = packingFee;
    }

    public Boolean isStatus() {
        return status;
    }

    public MerchandiseSku status(Boolean status) {
        this.status = status;
        return this;
    }

    public void setStatus(Boolean status) {
        this.status = status;
    }

    public Integer getAddedTimes() {
        return addedTimes;
    }

    public MerchandiseSku addedTimes(Integer addedTimes) {
        this.addedTimes = addedTimes;
        return this;
    }

    public void setAddedTimes(Integer addedTimes) {
        this.addedTimes = addedTimes;
    }
    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof MerchandiseSku)) {
            return false;
        }
        return id != null && id.equals(((MerchandiseSku) o).id);
    }

    @Override
    public int hashCode() {
        return 31;
    }

    @Override
    public String toString() {
        return "MerchandiseSku{" +
            "id=" + getId() +
            ", skuCode='" + getSkuCode() + "'" +
            ", merchandiseCode='" + getMerchandiseCode() + "'" +
            ", stock=" + getStock() +
            ", unitPrice=" + getUnitPrice() +
            ", weight='" + getWeight() + "'" +
            ", photos='" + getPhotos() + "'" +
            ", packingFee='" + getPackingFee() + "'" +
            ", status='" + isStatus() + "'" +
            ", addedTimes=" + getAddedTimes() +
            "}";
    }
}
